package com.liuqi.iot.web;

import com.liuqi.iot.bean.dto.DeviceHistoryData;
import com.liuqi.iot.bean.query.DeviceHistoryDataAggQuery;
import com.liuqi.iot.bean.query.DeviceHistoryDataQuery;
import com.liuqi.iot.service.DeviceHistoryDataService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 历史数据控制器 
 * @author Coder Generator 2025-03-22 20:51:27 
 **/
@RestController
@RequestMapping("/history-data")
@Slf4j
@Tag(name = "历史数据控制器")
public class DeviceHistoryDataController {
    @Autowired
    private DeviceHistoryDataService service;

    @PostMapping("query")
    public List<DeviceHistoryData> query(@RequestBody @Validated DeviceHistoryDataQuery query) {
        return service.query(query);
    }

    /**
     * 聚合查询
     */
    @PostMapping("agg-query")
    public List<DeviceHistoryData> aggQuery(@RequestBody @Validated DeviceHistoryDataAggQuery query) {
        return service.aggQuery(query);
    }
}